package com.qf.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.entity.EprOrders;
import com.qf.service.OrderDelService;
import com.qf.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * --- 机魂大悦 ---
 *
 * @author L
 * @date 2024/7/25
 * @desc
 */
@RestController
@RequestMapping("sell/orderDel")
public class OrderDelController {
    @Autowired
    private OrderDelService service;

    @GetMapping("/list")
    public R findAll(@RequestParam HashMap<String, String> map) {
        // 分页
        int pageNum = Integer.parseInt(map.get("pageNum"));
        int pageSize = Integer.parseInt(map.get("pageSize"));
        PageHelper.startPage(pageNum, pageSize);

        List<EprOrders> list = service.findAll(map);
        PageInfo<EprOrders> info = new PageInfo<>(list);

        return R.ok(info);
    }

    @PostMapping("/orderUpMeasure")
    public R orderUpMeasure(@RequestBody HashMap<String, String> map) {

        boolean upDataOk = service.upMeasure(map);
        return R.ok(upDataOk);
    }

    @PostMapping("/orderAddFind")
    public R orderAddFind(@RequestBody HashMap<String, String> map) {

        boolean addFind = service.orderAddFind(map);
        return R.ok(addFind);
    }
    @GetMapping("/orderDelById")
    public R orderDelById(int id) {

        boolean orderDelById = service.orderDelById(id);
        return R.ok(orderDelById);
    }
    @GetMapping("/orderDelMore")
    public R orderDelMore(@RequestParam List<Integer> ids) {
        boolean orderDelMore = service.orderDelMore(ids);
        return R.ok(orderDelMore);
    }

}
